import { ref } from "vue";
import service from "../index.js";

const salaryApi = {
    //查询根据日期查询所有的账单
    selectAll(pageNum,data){
        const params = {
            pageNum: pageNum,
            data: data
        }
        return service.get('/admin/salary', {params});
    },
    selectByMid(data,mid){
        const params = {
            data: data,
            mid: mid
        }
        return service.get('/admin/salary/mid', {params});
    },
    selectByMidAdd(mid){
        const now = new Date();

        const year = now.getFullYear();
        const month = ('0' + (now.getMonth() + 1)).slice(-2);
        const day = ('0' + now.getDate()).slice(-2);
        const data = year + '-'+ month + '-' +day;
        const params = {
            data: data,
            mid: mid
        }
        return service.get('/admin/salary/mid', {params});
    },
    update(salary){
        return service.put('/admin/salary',salary)
    },
    insert(salary){
        return service.post('/admin/salary',salary)
    },
    allMedical(){
        return service.get('/admin/salary/allMedical')
    },
    uploadExcel(data){
        const params = {
            data: data,
          };
        return service.get('/admin/file/download',{ params, responseType: 'blob'});
    },
    selectAllSalaryByMid(data,pageNum){
        const params = {
            pageNum: pageNum,
            data: data
        }
        return service.get('/emp/salary',{params});
    },selectBySid(sid){
        const params = {
            sid:sid
        }
        return service.get('/emp/salary/sid',{params})
    }
    
}
export default salaryApi;